home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / diskmags / 0022-3.564 / dmg-3442 / st_applc / cookies / prog2.txt < prev   
Text File  |  1992-04-03  |  2KB  |  83 lines

  1. *       Make standard Cookie Jar
  2. *       (c) 1991 Mathew Lodge
  3.  
  4. _p_cookies equ  $5A0            Cookie jar pointer
  5.  
  6. dos     equ     1
  7. xbios   equ     14
  8.  
  9. Pterm0  equ     $00
  10. Cconws  equ     $09
  11. Ptermres equ    $31
  12.  
  13. Supexec equ     38
  14.  
  15.  
  16. start:
  17.         bra     GO
  18.  
  19. standard_jar:
  20.         dc.l    '_CPU',0
  21.         dc.l    '_VDO',0
  22.         dc.l    '_SND',1
  23.         dc.l    '_MCH',0
  24.         dc.l    0,8
  25.         dc.l    0,0
  26.         dc.l    0,0
  27.         dc.l    0,0
  28.  
  29. GO:
  30.         move.l  a7,a5
  31.         move.l  #stack,sp       Set up our stack
  32.         move.l  4(a5),basepage  Get address of basepage
  33.         pea     inst_jar
  34.         move.w  #Supexec,-(sp)
  35.         trap    #xbios          Execute routine in super mode
  36.         addq.l  #6,sp
  37.  
  38.         tst.w   success         Jar installed?
  39.         beq     TSR             Terminate and Stay Resident
  40.  
  41.         move.w  #Pterm0,-(sp)   Otherwise, normal termination
  42.         trap    #1
  43.  
  44. TSR     move.l  basepage,d0     Address of basepage
  45.         move.l  #GO,d1          End of resident data
  46.         sub.l   d0,d1           Calculate size of resident block
  47.         move.l  d1,-(sp)        The amount of memory to save
  48.         move.w  #Ptermres,-(sp)
  49.         trap    #dos            Terminate and Stay Resident
  50.  
  51. inst_jar:
  52.         move.l  _p_cookies,d0
  53.         bne     already_jar     Jar installed?
  54.         move.l  #standard_jar,_p_cookies       Install jar
  55.         clr.w   success         Indicate success
  56.         rts
  57.  
  58. already_jar:
  59.         lea     already_jarm,a1 Jar installed message
  60.         bsr     print_stg
  61.         move.w  #1,success      Unsuccessful
  62.         rts
  63.         
  64. print_stg:
  65.         move.l  a1,-(sp)
  66.         move.w  #Cconws,-(sp)   Print to screen
  67.         trap    #dos
  68.         addq.l  #6,sp
  69.         rts
  70.  
  71.         cnop    0,4             Word align     
  72. basepage:
  73.         ds.l    1
  74. success ds.w    1
  75.  
  76. already_jarm:
  77.         dc.b    'Cookie Jar already installed',13,10,0
  78.         
  79.         ds.l    99
  80. stack   ds.l    1
  81.  
  82.         END
  83.